<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>path</h1>
    <form action="" method="" id="form">
        <input type="text" id="ipt">
        <button id="btn">提交</button>
    </form>

    <script>
         const form = document.getElementById('form')   
         const oIpt = document.getElementById('ipt')   
         const oBtn = document.getElementById('btn')
         
         form.onsubmit = function(){
            const id = oIpt.value

            const xhr = new XMLHttpRequest();
            xhr.open("GET",`/userInfo/${id}?_=${Date.now()}`,true);
            xhr.send();
            xhr.onreadystatechange = function(){
                if(xhr.readyState === 4 && (xhr.status >= 200 && xhr.status <= 299)){
                    const data = JSON.parse(xhr.responseText)
                    console.log(data);
                }
            }

            return false
         }
    </script>
</body>
</html>